from typing import Optional
from pydantic import BaseModel
from datetime import datetime


class CreateShippingAddressRequest(BaseModel):
    created_on: Optional[datetime] = None
    created_by: Optional[int] = None
    customer_id: Optional[int] = None
    recipient: str
    phone: str
    province: str
    city: Optional[str] = None
    district: Optional[str] = None
    details_address: Optional[str] = None
    is_default: Optional[bool] = False


class ShippingAddressModel(BaseModel):
    id: int
    created_on: Optional[datetime] = None
    created_by: Optional[int] = None
    updated_on: Optional[datetime] = None
    updated_by: Optional[int] = None
    status: Optional[int] = 1
    customer_id: int
    recipient: str
    phone: str
    province: str
    city: Optional[str] = None
    district: Optional[str] = None
    details_address: Optional[str] = None
    is_default: Optional[bool] = False

    class Config:
        from_attributes = True


class UpdateShippingAddressRequest(BaseModel):
    updated_on: Optional[datetime] = None
    updated_by: Optional[int] = None
    id: int
    recipient: str
    phone: str
    province: str
    city: Optional[str] = None
    district: Optional[str] = None
    details_address: Optional[str] = None


class SetDefaultAddressRequest(BaseModel):
    id: int
